source("scripts_cluster/cluster.R")

stock_list = read.csv("hold_list.txt", colClasses="character", head=T);
stock_len = length(stock_list[,1]);
sample = sample_stock(stock_list$Name[2:stock_len], 20);

cluster_res = kmeans(sample, 11);
distance = sample_distance(sample, cluseter_res$centers);

distance = cbind(Cluster=cluster_res$cluster, distance);
distance = cbind(Name=stock_list$Name[2:stock_len], distance);
write.csv(distance, "cluster_distance.txt", row.names=F);